<?php
namespace app\index\controller;

use app\BaseController;
use think\facade\Db;
use think\facade\Request;

class Wxcheck extends Base
{
   
    public function index()
    {
    if(request()->isPost()) {
            $data = input('post.');
            $domain=$data['domain'];
            $url="https://api.dzzui.com/api/check_wx?url=".$domain;
$result = file_get_contents("$url");

$arr=json_decode($result,true);
if ($arr["code"] == 1) {
 
   return alert($arr['msg'],'/index/wxcheck/index',6,3);

} else {

    return alert($arr['msg'],'/index/wxcheck/index',5,3);

}


        }else {

            
            return view();

        }
    }

 
    public function product(){
    $id=input('id');
    $login =session('userAccount'); 
 $archivesData=Db::name('website')->where('id',$id)->find();
 $cate_id=$archivesData['cate_id'];
  $cateData=Db::name('cate')->where('id',$cate_id)->find();
  $cate=$cateData['cate_name'];
   $orderData=Db::name('order')->where('uid',$login['id'])->where('webid',$id)->where('status','>',0)->find();
   $ispaytype=$orderData['type'];
        $paycate="1";
        return view('',[
        'archivesData'=>$archivesData,
        'cate'=>$cate,
         'login'=>$login,
         'ispaytype'=>$ispaytype,
         'paycate'=>$paycate,
        ]);
    }


    public function list(){
        $id=input('id');

       $categoryData=Db::name('category')->find($id);
       $archivesData=Db::name('archives')->field('id,time,title')->where('cate_id',$id)->paginate(20);
       //print_r($archivesData);
        return view('',[
            'categoryData'=>$categoryData,
            'archivesData'=>$archivesData,
            'menu_id'=>$id
        ]);
    }
  
  public function productlist(){
       $id=input('cate_id');
       $typeData=Db::name('category')->select();
       $archivesData=Db::name('archives')->where('cate_id',$id)-> paginate([
              'list_rows'=> 20,//每页数量
              'query' => request()->param(),
              ]);
            
        return view('',[
            'archivesData'=>$archivesData,
            'typeData'=>$typeData,
            'menu_id'=>7
        ]);
    }
    public function contact(){
        $id=7;
        $categoryData=Db::name('category')->find($id);
        return view('',[
            'categoryData'=>$categoryData,
            'menu_id'=>7
        ]);
    }

    public function article(){
        $id=input('id');

       $archivesData=Db::name('archives')->find($id);
       $categoryData=Db::name('category')->find($archivesData['cate_id']);

        return view('',[
            'categoryData'=>$categoryData,
            'archivesData'=>$archivesData,
            'menu_id'=>$id
        ]);
    }

  
}
